home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_06 / prince / xmath.h < prev   
Text File  |  1994-01-24  |  2KB  |  51 lines

  1. #include "math.h"
  2. #include <errno.h>
  3. #include <float.h>
  4. typedef union { /* VAX compatibility discarded for simplicity */
  5.     double _D;
  6.      unsigned long _W[2]; 
  7.     } _Dvar;
  8. /* this section belongs in yvals.h according to Plauger */
  9. #define _D0 0    /* big-endian order */
  10. #define _DOFF 20 /* IEEE double format, using union of longs */
  11. #define _DSIGN 0x80000000    /* not given in article: sign bit mask */
  12. #define _DBIAS 1022    /* not given in article: exponent field of 0.0 */
  13. #define _FOFF (FLT_MANT_DIG - 1)
  14. /* end of section from yvals.h */
  15. #define _DFRAC ((1<<_DOFF)-1)
  16. #define _DMASK ( ~_DFRAC) /* wrong in article */
  17. #define _DMAX ((1<<(31-_DOFF))-1)    /* 15 for short */
  18. #define _DNAN (0x80000000|_DMAX<<_DOFF|1<<(_DOFF-1))    /* 8000 */
  19. #define _D1    (1-_D0)            /* word order VAX */
  20. #define FINITE -1
  21. #define INF    1
  22. #define NAN    2
  23. #define NBITS (32+_DOFF)
  24. #define DSIGN(x) (((unsigned long *)&(x))[_D0]&_DSIGN)
  25. #define HUGE_EXP    (int)(_DMAX * 900L / 100) /* correct bug in Plauger */
  26. #define HUGE_RAD    3.14e30
  27. #define SAFE_EXP    (_DMAX>>1)
  28.         /* declarations */
  29. double _Atan();
  30. double _Atant();
  31. int _Dint();
  32. int _Dnorm();
  33. int _Dscale();
  34. double _Dtento();
  35. int _Dtest();
  36. #define _Dtest(x) ((x)>DBL_MAX||(x)<-DBL_MAX?INF:(x)!=(x)?NAN:(x)!=0?FINITE:0)
  37. int _Dunscale();
  38. int _Exp();
  39. int _Ldunscale();
  40. double _Poly();
  41. double _Asin();
  42. double _Log();
  43. double _Sin();
  44. extern _Dconst _Hugeval;
  45.         /* macro overrides */
  46. #define acos(x)    _Asin(x, 1)
  47. #define cos(x)    _Sin(x, 1)
  48. #define sin(x)    _Sin(x, 0)
  49. double _Logf(double);
  50. int _Expf(double *);
  51.